package com.wmm.fast.main.controller;

import com.wmm.common.bean.ResponseResultDTO;
import com.wmm.common.bean.user.UserDTO;
import com.wmm.fast.main.feign.UserInterface;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "/api/feign/user", description = "用户消费服务")
@RestController
@RequestMapping("/api/feign/user")
public class UserController {

    @Autowired
    private UserInterface userInterface;

    @ApiOperation(value = "获取用户信息", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "userID,根据用户id查找用户信息,采用feign调用user-service,降级时间1000ms", required = true, paramType = "query")})
    @RequestMapping("/find/{userId}")
    public ResponseResultDTO<UserDTO> find(@PathVariable String userId) {
        return userInterface.find(userId);
    }
}
